﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace HowItWentDown
{
    public enum Effects { NoEffects, Blur };
    public static class Global
    {
        public static bool Win = false;
        public static Game1 Doc;
        static float framespeed = 1;
        public static float GameSpeed = 1;
        public static float speed = 1;
        public static float Speed
        {
            get { return speed; }
        }
        public static Player Player;
        public static Companion Companion;
        static TimeSpan elapsedTime;
        static float fps;
        /// <summary>
        /// The effects techniques used will be based on this setting
        /// </summary>
        public static Effects Effects = Effects.NoEffects;
        /// <summary>
        /// Gets and sets the desired framerate of the game
        /// </summary>
        public static float FPS
        {
            set
            {
                fps = value;
                Doc.TargetElapsedTime = TimeSpan.FromSeconds(1f / value);
            }
            get
            {
                return fps;
            }
        }
        public static void Update(TimeSpan elapsed)
        {
            elapsedTime = elapsed;
            framespeed = ((float)Doc.TargetElapsedTime.TotalSeconds / (float)elapsed.TotalSeconds) * (60f/fps);
            if (!float.IsInfinity(framespeed) && !float.IsNaN(framespeed))
                speed = GameSpeed * framespeed;
            else
                speed = GameSpeed;
        }
        /// <summary>
        /// Load an image from the content project.
        /// </summary>
        /// <param name="name">The name of the file you plan to load. Do not include file extensions (do not include ".png"). Use two slashes for files inside of folders, ex. "Folder//Image.png."</param>
        /// <returns>Returns a Texture2D object of the file you loaded.</returns>
        public static Texture2D LoadTexture(string name)
        {
            return Doc.Content.Load<Texture2D>(name);
        }
        public static Effect LoadEffect(string name)
        {
            return Doc.Content.Load<Effect>(name);
        }
    }
}
